#pragma once

#include "stdafx.h"
#include "ResourceManager.h"
#include "Sprite.h"



class Entity
{
protected:
	ENTITY_TYPE m_type;
	double m_orientation;
	int m_centerX;
	int m_centerY;
	Sprite* m_sprite;
public:
	enum ENTITY_TYPE {TYPE_TANK, TYPE_BULLET, TYPE_TURRET};
	Entity(ENTITY_TYPE type=TYPE_TANK, int cX=0,int cY=0, double o=0.0, int rID=-1)
		: m_centerX(cX),m_centerY(cY),m_orientation(o),m_type(type) 
	{
		m_sprite = new Sprite(rID,cX,cY,o);
		
	}

	~Entity() { delete(m_sprite); }

	double GetOrientation() const { return m_orientation; }
	void SetOrientation(double o) 
	{ 		
		m_orientation = o;
		if(m_orientation >= 360.0) m_orientation -= 360.0;
		m_sprite->SetAngle(m_orientation);
	}
	void AugmentOrientation(double add = 0.0)
	{
		m_orientation += add;
		if(m_orientation >= 360.0) m_orientation -= 360.0;
		m_sprite->SetAngle(m_orientation);
	}

	int GetX() const { return m_centerX; }
	int GetY() const { return m_centerY; }
	void SetX(int centerX) { m_centerX = centerX; }
	void SetY(int centerY) { m_centerY = centerY; }
	ENTITY_TYPE GetType() const { return m_type; }
	Sprite* GetSprite() const { return m_sprite; }
};
